<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>">

		<title>操作历史记录</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet" href="css/common.css" type="text/css" />
		<link rel="stylesheet"
			href="<%=basePath%>/css/jquery-ui-1.8.5.custom.css" type="text/css" />
		<script src="<%=basePath%>js/jquery-1.5.js" language="javascript">
		</script>
		<script src="<%=basePath%>js/table.js" language="javascript">
		</script>
		<script src="<%=basePath%>/js/pageInfo.js" type="text/javascript">
		</script>
		<script
			src="<%=request.getContextPath()%>/js/jquery-ui-1.8.5.custom.min.js"
			language="javascript">
		</script>
		<script type="text/javascript">
var index = 1;
var size = '<s:property value="pageInfo.pageSize"/>';
$(function(){
	$("table.pagecss").hide();
})
//查询历史记录
function queryHistory() {
	ajaxSubmit(index,size)
	$("table.pagecss").show();
}
function ajaxSubmit(index, size) {
		var param={};
		param.index=index;
		param.pageSize=size;
		if($("#operateType").val()!=''){
			param.operateType=$("#operateType").val();
		}
		if($("#role").val()!=''){
			param.userType=$("#role").val();
		}

		$.post("json/queryOperateHistoryAction",param,function(data){
			var page = eval('(' + data.pageJson + ')');
			initPage(page.totalPage, page.pageIndex, page.pageSize, page.totalRec);
			result=eval("("+data.showJson+")")
			fillResult(result);
		})
}
function fillResult(data){
	
	$("table#searchResult tr:gt(0)").remove();
	
	for(var i=0;i<data.length;i++){
		var person="未知";
		var college="无";
		var role="无";
		var opeateTime;
		var operate;
		 operateType=data[i].operateType.operate;
		if(data[i].tuser){
			person=data[i].tuser.userName;
			
			if(data[i].tuser.colleges){
				college=data[i].tuser.colleges.collegesName;
			}
			role=data[i].tuser.userType.typeName;
		}
		var date=new Date(data[i].operateTime)
		opeateTime=date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+":"+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();

		operate=data[i].operateDescription;
		var tr='<tr><td align="center">'+(i+1)+'</td><td align="left">'+operateType+'</td><td align="center">'+person+'</td>	<td align="center">'+role+'</td><td align="center">'+college+'</td><td align="left">'+operate+'</td><td align="left">'+opeateTime+'</td></tr>'
		$("#searchResult").append(tr);
	}
	$("table#searchResult tr:gt(0):even").css('background','#deefff'); 
}
</script>
	</head>
	<body>
	<div class="adminhead">
			<jsp:include page="head.jsp"></jsp:include>
		</div>
		<div class="adminmain">
			<div class="left">
				<jsp:include page="leftMenu.jsp"></jsp:include>
			</div>
			<div class="right">
				<div id="nav">
			<ul>
				<li class="bg_image_onclick">
					操作历史记录
				</li>
			</ul>
		</div>
		<div id="sub_info">
			&nbsp;&nbsp;
			<img src="images/hi.gif" />
			&nbsp;
			<span id="show_text">欢迎进入新生报告系统后台管理!</span>您现在正在：管理员操作&gt;&gt;&gt;操作历史记录
		</div>

		<div id="man_zone">
			<!--************************************************************-->
			<table border="0" align="center" cellpadding="0" cellspacing="5"
				style="margin-top: 20px;">
				<tr>
					<td>
						操作类型：
					</td>
					<td>
						<s:select list="operateTypes" listKey="operate"
							listValue="operate" headerKey="" headerValue="全部"
							id="operateType" theme="simple"></s:select>
					</td>
					<td>
						操作角色：
					</td>
					<td>
						<s:select list="userTypes" listKey="typeName" listValue="typeName"
							headerKey="" headerValue="全部" id="role" theme="simple"></s:select>
					</td>
					<td>
						<input type="button" value="查询" onclick="queryHistory()" />
					</td>
				</tr>
			</table>
			<!--************************************************************-->
			<span id="noResult" style="color: red; font-size: 20px"></span>
			<div id="showResult" style="display: block">
				<table id="searchResult" width="1000" border="0" align="center"
					cellpadding="0" cellspacing="1" class="t1"
					style="border: 1px solid #5cb0ff; margin-top: 20px;">
					<tr style="color: #000;">
						<th align="center">
							序号
						</th>
						<th align="center" style="width: 10%">
							操作类型
						</th>
						<th align="center">
							操作人
						</th>
						<th align="center" style="width: 10%">
							操作角色
						</th>
						<th align="center"  style="width: 10%">
							学院
						</th>
						<th align="center">
							操作内容
						</th>
						<th align="center">
							时间
						</th>
					</tr>
				</table>
				<!--上一页，下一页 开始-->
				<table width="1000" border=0 class="pagecss" align="center" style="display: none">
					<tr>
						<td align="left">
							<span id="AllPage">共几页/几条</span>
							<span id="setupNum">显示每页记录条数</span>
							<select id="setSize"
								onchange="ajaxChangeCount(this.options[this.options.selectedIndex].value)">
							</select>
						</td>
						<td align="right">
							<span id="Flexigrid_Bar"><a href="">上5页</a>&nbsp;<span
								class="dan">1</span>&nbsp;<a href="">2</a>&nbsp;<a href="">3</a>&nbsp;<a
								href="">下5页</a>&nbsp; </span>
							<span id="checkPage"><input type="text"
									style="width: 20px;"> &nbsp;页<a href="">GO</a> </span>
						</td>
					</tr>
				</table>
				<!--上一页，下一页 结束-->
				<!--************************************************************-->
			</div>
		</div>


		</div>
			</div>

		<div class="adminfooter">
			<jsp:include page="footer.jsp"></jsp:include>
		</div>
		
	</body>
</html>
